<template>
  <div class="sw-title">
    <div class="sw-title-main flex-box">
      <div @click="goBack" class="left flex-box norem">
        <svg class="icon" aria-hidden="true">
          <use xlink:href="#icon-wenzheng-jiantou2"></use>
        </svg>
      </div>
      <div class="center">
        <p>善问医生</p>
      </div>
      <div class="right flex-box norem" :class="{active:swnavShow}" @click="swnavShow=!swnavShow" data-show="false">
        <div><span></span>
        <span></span>
        <span></span></div>
      </div>
    </div>
    <transition name="translateNav" active-class="slide-active">
      <div class="sw-nav" v-show="swnavShow">
        <ul>
          <li><router-link @click="navHide" class="flex-box" to="/"><svg class="icon" aria-hidden="true">
              <use xlink:href="#icon-wenzheng-shouyeSVG"></use>
            </svg><span>首页</span></router-link></li>
          <li><router-link @click="navHide" class="flex-box" to="/"><svg class="icon" aria-hidden="true">
              <use xlink:href="#icon-wenzheng-weibiaoti-"></use>
            </svg><span>提问</span></router-link></li>
          <li><router-link @click="navHide" class="flex-box" to="/mine"><svg class="icon" aria-hidden="true">
              <use xlink:href="#icon-wenzheng-wodeSVG"></use>
            </svg><span>我的</span></router-link></li>
        </ul>
      </div>
    </transition>
  </div>
</template>
<script>
// @ is an alias to /src
export default {
  data() {
    return {
      list: '',
      swnavShow: false
    }
  },
  name: 'needs',
  components: {},
  computed: {},
  methods: {
    goBack() {
      this.$router.go(-1)
    },
    navHide() {
      this.swnavShow = false
    }
  },
  created() {},
  mounted() {}
}
</script>
<style lang="scss" scoped>
.sw-title {
  width: 100%;
  height: 44px;
  position: relative;
  .icon {
    vertical-align: top;
  }
  .sw-title-main {
    max-width: 750px;
    height: 100%;
    margin: 0 auto;
    justify-content: space-between;
    color: #fff;
    padding-left: r(20);
    padding-right: r(20);
    background: -webkit-linear-gradient(left, #94d2ff, #3faaf8);
    background: linear-gradient(to right, #94d2ff, #3faaf8);
    box-sizing: border-box;
    position: relative;
    z-index: 999999;
    .norem {
      width: 24px;
      height: 24px;
      border-radius: 100%;
      border: 1px solid #fff;
      text-align: center;
      box-sizing: border-box;
      font-size: r(18);
      line-height: 24px;
      position: relative;
    }
    .right {
      flex-wrap: wrap;
      & > div {
        width: 100%;
        padding-left: r(5);
        padding-right: r(5);
      }
      span {
        display: block;
        background: #fff;
        margin-bottom: 2px;
        width: 100%;
        height: 1px;
        float: left;
        transition: 0.35s ease;
        &:last-child {
          margin-bottom: 0;
        }
      }
    }
    .active {
      span {
        &:first-child {
          transform: rotateZ(45deg) translate3d(2px, 2px, 0);
        }
        &:nth-child(2) {
          transform: rotateY(90deg);
        }
        &:last-child {
          transform: rotateZ(-45deg) translate3d(2px, -2px, 0);
        }
      }
    }
    .center {
      font-size: r(16);
      p {
        color: #fff;
      }
    }
  }
  .sw-nav {
    position: absolute;
    width: r(72);
    height: r(106);
    right: r(15);
    top: r(43);
    overflow: hidden;
    z-index: 99999;
    transition: 0.25s ease;
    -webkit-transition: 0.25s ease;
    ul {
      display: block;
      width: 100%;
      height: 100%;
      position: absolute;
      left: 0;
      border-bottom-right-radius: r(6);
      border-bottom-left-radius: r(6);
      background: rgba($color: #fff, $alpha: 1);
      transition: 0.25s ease;
      border: 1px solid #ddd;
      -webkit-transition: 0.25s ease;
      overflow: hidden;
      padding-top: r(8);
      box-sizing: border-box;
      li {
        width: 100%;
        float: left;
        font-size: r(16);
        color: #333;
        text-align: center;
        a {
          span {
            margin-left: 4px;
            color: #55b0ff;
            position: relative;
            top: 2px;
          }
          color: #82c5ff;
          line-height: r(30);
          text-decoration: none;
        }
      }
    }
  }
}
.slide-active {
  transition: 0.3s cubic-bezier(0.55, 0, 0.1, 1);
  transition-property: opacity, transform;
}
.translateNav-enter,
.translateNav-leave-to {
  opacity: 0;
  transform: translate3d(0, -20px, 0);
}
</style>
